#ifdef GL_ES
precision mediump float;
#endif

uniform sampler2D sampler2d;
varying vec2 vtex;

uniform float iTime;

//旋转函数
vec2 rota(vec2 pos, float rad)
{
    float c = cos(rad);
    float s = sin(rad);
    mat2 m = mat2(c, -s, s, c);
    return pos*m;
}
//旋转函数
vec2 rota2(vec2 uv, float a)
{
	// [uv.x uv.y] * [cos(a),  sin(a),
	//                -sin(a), cos(a)]
	return vec2(uv.x * cos(a) - uv.y * sin(a), uv.y * cos(a) + uv.x * sin(a));
}

void main (void)
{
	vec2 uv = vtex - vec2(0.5, 0.5);
	uv = rota(uv, -45.) + vec2(0.5, 0.5);
	gl_FragColor = texture2D(sampler2d, uv);
    return;
}



